<include file="public:header" />
<!--管理-->
<div class="pad_lr_10">
  <form name="searchform" method="get" >
    <table width="100%" cellspacing="0" class="search_form">
        <tbody>
            <tr>
                <td>
                <div class="explain_col">
                    <input type="hidden" name="g" value="admin" />
                    <input type="hidden" name="m" value="sales" />
                    <input type="hidden" name="a" value="index" />
                    <input type="hidden" name="menuid" value="{$menuid}" />
                     <b>搜索条件：</b><br />
                     销售时间 ：
                    <input type="text" name="time_start" id="time_start" class="date" size="12" value="{$search.time_start}">
                    -
                    <input type="text" name="time_end" id="time_end" class="date" size="12" value="{$search.time_end}">
					
                &nbsp;&nbsp;请选择厅店：
                <select class="J_cate_select mr10" data-pid="0" data-uri="{:U('region/ajax_getchilds',array('max_level'=>4,'type'=>'store'))}" data-selected="{$search.selected_ids}"></select>
                <input type="hidden" name="regionId" id="J_cate_id" value="{$search.cate_id}" />                   

                &nbsp;&nbsp;请选择品牌：
                <select name="brandId" id="brand_select_add">
                    <option value="">请选择品牌</option>
                    <volist name="brandList" id="item">
                        <option <if condition="$key eq $search['brandId']">selected=""</if> value="{$key}">{$item}</option>
                    </volist>
                </select>
				&nbsp;&nbsp;请选择机型：
                <select name="modelId" id="model_select_add">
                    <option value="0">{:L('please_select_brand')}</option>
                    
                </select> 
			     
                &nbsp;&nbsp;员工 :
                <input name="userName" type="text" class="input-text" size="12" value="{$search.userName}" />
                &nbsp;&nbsp;imei :
                <input name="imei" type="text" class="input-text" size="12" value="{$search.imei}" />                
                &nbsp;&nbsp;{:L('store_channel')}:
                <select name="channel">
                    <option value="">-{:L('all')}-</option>
                    <option value="1" <if condition="$search.channel eq '1'">selected="selected"</if>>{:L('store_channel1')}</option>
                    </select> 
                &nbsp;&nbsp;验证:
                <select name="verify">
                    <option value="">-{:L('all')}-</option>
                    <option value="1" <if condition="$search.verify eq '1'">selected="selected"</if>>通过</option>
                    <option value="-1" <if condition="$search.verify eq '-1'">selected="selected"</if>>不通过</option>
                    <option value="0" <if condition="$search.verify eq '0'">selected="selected"</if>>未验证</option>
                </select>                
              
                <!--br />
                <b>统计条件:</b><br />
                分组统计:
                <label><input type="radio" name="group" <if condition="$search.group eq 'bigcity.id'"> checked=""</if> value="bigcity.id" />按省份</label>  
                <label><input type="radio" name="group" <if condition="$search.group eq 'city.id'"> checked=""</if> value="city.id" />按地市</label>                                
                <label><input type="radio" name="group" <if condition="$search.group eq 'r.id'"> checked=""</if> value="r.id" />按片区统计</label>
                <label><input type="radio" name="group" <if condition="$search.group eq 's.storeId'"> checked=""</if> value="s.storeId" />按厅店统计</label>
            <label><input type="radio" name="group" <if condition="$search.group eq 'm.brandId'"> checked=""</if> value="m.brandId" />按品牌统计</label>                
                <label><input type="radio" name="group" <if condition="$search.group eq 's.modelId'"> checked=""</if> value="s.modelId" />按机型统计</label>
                <label><input type="radio" name="group" <if condition="$search.group eq 's.userId'"> checked=""</if> value="s.userId" />按人员统计</label>

                              
                <label><input type="radio" name="group" <if condition="$search.group eq ''"> checked=""</if> value="" />取消</label-->          
                <input type="hidden" name="opttype" value="search" />      
                <input type="button" name="search" class="btn" value="搜索" />
                <input type="button" name="export" class="btn" value="导出excel" />
					
                </div>
                </td>
            </tr>
        </tbody>
    </table>
    </form>


    <div class="J_tablelist table_list" data-acturi="{:U('store/ajax_edit')}">
        <table width="100%" cellspacing="0">
            <thead>
            <tr>
                <th width="40"><input type="checkbox" name="checkall" class="J_checkall"></th>
                <th width="40">ID</th>
                <th><span data-tdtype="order_by" data-field="storeId">{:L('store_name')}</span></th>
                <th>亚信编码</th>
                
                <th>{:L('REGION_CATE_NAME')}</th>
                <th><span data-tdtype="order_by" data-field="modelId">机型</span></th>
                <th><span data-tdtype="order_by" data-field="userId">销售人员</span></th>
                <th><span data-tdtype="order_by" data-field="imei">imei</span></th>
                <th><span data-tdtype="order_by" data-field="createTime">销售时间</span></th>
                <th>验证信息</th>
      		    <th><span data-tdtype="order_by" data-field="number">数量</span></th>
                <!--th width=100>{:L('operations_manage')}</th-->
            </tr>
            </thead>
    	    <tbody>
            <volist name="list" id="val" >
            <tr>
                <td align="center"><input type="checkbox" class="J_checkitem" value="{$val.id}"></td>
                <td align="center">{$val.id}</td>
                <td align="center">{$val['storeName']}</td>
                <td align="center">{$val['storeCtms']}</td>
                
                <td align="center">
                    <if condition="$search.group eq 'bigcity.id'">            
                        {$val.bigcityName}
                    <elseif condition="$search.group eq 'city.id'" />
                        {$val.bigcityName}=》{$val.cityName}
                    <else />
                        {$val.bigcityName}=》{$val.cityName}=》{$val.regionName}
                    </if>
                </td>
                
                <td align="center">{$val['modelName']}</td>
                
                <td align="center">{$val['userRealName']}</td>
                <td align="center">{$val.imei}</td>
                <td align="center">{$val.createTime}</td>
                <td align="center"><if condition="$val.verify eq 1">有效<elseif condition="$val.verify eq -1"  />无效<else />未验证</if></td>
                <td align="center"><if condition="$val.number gt 0">{$val.number}<else />1</if></td>
                <td align="center">
                
                    <!--a href="javascript:;" class="J_confirmurl" data-uri="{:U('sales/delete', array('id'=>$val['id']))}" data-msg="{:sprintf(L('confirm_delete_one'),$val['name'])}">{:L('delete')}</a-->
                </td>
            </tr>
            </volist>
    	   </tbody>
        </table>
    </div>
    <div class="btn_wrap_fixed">
		<label class="select_all mr10"><input type="checkbox" name="checkall" class="J_checkall">{:L('select_all')}/{:L('cancel')}</label>
    	<input type="button" class="btn" data-tdtype="batch_action" data-acttype="ajax" data-uri="{:U('sales/delete')}" data-name="id" data-msg="{:L('confirm_delete')}" value="{:L('delete')}" />
		<div id="pages">{$page}</div>
    </div>
</div>
<include file="public:footer" />
<script>
$('.J_cate_select').cate_select({top_option:lang.all});
</script>
<link rel="stylesheet" type="text/css" href="__STATIC__/js/calendar/calendar-blue.css"/>
<script src="__STATIC__/js/calendar/calendar.js"></script>
<script>
Calendar.setup({
    inputField : "time_start",
    ifFormat   : "%Y-%m-%d",
    showsTime  : false,
    timeFormat : "24"
});
Calendar.setup({
    inputField : "time_end",
    ifFormat   : "%Y-%m-%d",
    showsTime  : false,
    timeFormat : "24"
});

$("#brand_select_add").change(function(){
   var _this = $("#brand_select_add");
   var brand_id = _this.val();
   var ajax_get_region = "{:U('model/getModelList')}";
   if(brand_id){
    $.ajax({
        url:ajax_get_region,
        data:"brand_id="+brand_id,
        dataType:"json",
        success:function(data){
            if(data.status==1){
                var str = '<option value="0">'+lang.please_select+'</option>';
                for(d in data.data){
                    str +='<option value="'+d+'">'+data['data'][d]+'</option>';
                }
                $("#model_select_add").html(str);
            }
        }
    });        
   }else{
        $("#model_select_add").empty();
   }  
 });
 $("#brand_select_add").change();
 
 $("input[name=search]").click(function(){
    $("input[name=opttype]").val('search');
    $("form[name=searchform]").attr('target','_self');
    $("form[name=searchform]").submit();
 });
 $("input[name=export]").click(function(){
    $("input[name=opttype]").val('export');
    $("form[name=searchform]").attr('target','_blank');
    $("form[name=searchform]").submit();
 });
</script>
</body>
</html>